package com.rbc.rlslips.logger;

import org.apache.log4j.Logger;

import com.rbc.rlslips.enums.CommonEnums;


public final class RLLogger {
	
	public static void debug(Logger logger,String message,Object... objects){
		logger.debug(buildLogMessage(message, objects));
	}
	
	public static void info(Logger logger,String message,Object... objects){
		logger.info(buildLogMessage(message, objects));
	}
	
	public static void warn(Logger logger,String message,Object... objects){
		logger.warn(buildLogMessage( message, objects));
	}
	
	public static void error(Logger logger,String message,Object... objects){
		logger.error(buildLogMessage( message, objects));
	}
	
	public static void fatal(Logger logger,String message,Object... objects){
		logger.fatal(buildLogMessage(message, objects));
	}
	
	private static Object buildLogMessage(String message,Object... objects){
		StringBuffer buffer = new StringBuffer(message);
		buffer.append("[");
		for(Object object : objects){
			buffer.append(CommonEnums.LOGGER_DELIMITER.getEnumVal());
			buffer.append(object);
		}
		buffer.append("]");
		return buffer.toString();
	}
	public static void main(String[] args) {
		Logger logger = Logger.getLogger(RLLogger.class);
		debug(logger,"Entering debug method","input1","input2","input3");
	}

}
